/**
 * 功能请求相关类型定义
 */

// 功能请求状态枚举，值与后端保持一致，全部为字符串
export enum FeatureRequestStatus {
  PENDING = 'pending',     // 待审核
  APPROVED = 'approved',   // 已批准
  REJECTED = 'rejected',   // 已拒绝
  IN_PROGRESS = 'in_progress', // 开发中
  COMPLETED = 'completed', // 已完成
  PLANNED = 'planned'      // 计划中
}

// 功能请求项
export interface FeatureRequest {
  id: number;
  title: string;
  description: string;
  user_id: number;
  user_name: string;
  status: FeatureRequestStatus;
  votes_count: number;
  progress: number;
  admin_note: string;
  create_time: string;
  update_time: string;
  admin_id: number;
  admin_name: string;
  is_anonymous: boolean;
  has_voted: boolean; // 前端追加属性，表示当前用户是否已投票
  custom_name?: string; // 匿名用户自定义名称
}

// 功能请求详情
export interface FeatureRequestDetail extends FeatureRequest {
  // 可能包含的扩展信息
  admin_comments?: string;
  admin_remark?: string; // 管理员备注（兼容不同字段名）
  expected_release_date?: string;
  related_links?: string[];
  custom_name?: string; // 匿名用户自定义名称
}

// 功能请求查询参数
export interface FeatureRequestQueryParams {
  status?: string[]; // 状态筛选，传递字符串数组，与后端一致
  search?: string;
  sort?: 'votes_desc' | 'votes_asc' | 'newest' | 'oldest'; // 排序方式，需与后端一致
  page?: number;
  pageSize?: number;
}

// 功能请求列表响应
export interface FeatureRequestsResponse {
  total: number;
  list: FeatureRequest[];
}

// 功能请求提交参数
export interface FeatureRequestSubmitParams {
  title: string;
  description: string;
  is_anonymous?: boolean;
  custom_name?: string; // 匿名用户自定义名称
}

// 功能请求投票响应
export interface FeatureVoteResponse {
  success: boolean;
  message: string;
  votes_count: number;
  daily_votes_left?: number;
}

// 功能状态统计响应
export interface FeatureStatusStats {
  total: number;
  pending: number;
  approved: number;
  rejected: number;
  in_progress: number;
  completed: number;
  planned: number;
  today_votes: number;
  max_daily_votes: number;
}

// 功能请求提交响应
export interface FeatureRequestSubmitResponse {
  id: number;
  message?: string;
  success?: boolean;
} 